home *** CD-ROM | disk | FTP | other *** search
/ Collection of Tools & Utilities / Collection of Tools and Utilities.iso / tex / cspelsrc.zip / CSPELLA.C < prev    next >
Text File  |  1987-12-09  |  49KB  |  2,320 lines

  1.  
  2.               /*              PROGRAM dumb.C                 */
  3.               /*              by Peter A. Banks              */
  4.               /*             Home phone 481-8242             */
  5.               /*             Work Phone 568-4855             */
  6.               /*         Compiled  under Turbo C (tcc)       */
  7.               /*         linked  with Microsoft linker       */
  8.               /*          Turbo's linker did not work        */
  9.  
  10.  
  11.  
  12.  
  13. #include "stdio.h"
  14.  
  15. #include "io.h"
  16.  
  17. #include "alloc.h"
  18.  
  19. #include "conio.h"
  20.  
  21. #include "ctype.h"
  22.  
  23. #include "stdlib.h"
  24.  
  25. #include "dir.h"
  26.     
  27. #include "string.h"
  28.      
  29. #include "DOS.H"
  30.  
  31. #include "limits.h"
  32.  
  33. #include "stddef.h"
  34.  
  35.  
  36.  
  37. #define NO_DEBUG
  38.  
  39. #define LINELIM  255 /* maX NUMBER 
  40. CHARACTERS PER LINE */
  41.  
  42. #define WORDSTAR 0
  43.  
  44. #define SEDT_PTP 144
  45.  
  46. #define MAXWRD 20  
  47.  
  48. #define MAXLINE  255
  49.  
  50. #define CRET 13
  51.  
  52. #define DEL  127
  53.  
  54. #define PERIOD 46
  55.  
  56. #define BCKSP  8
  57.  
  58. #define COLON 58
  59.  
  60. #define SLASH 47
  61.  
  62. #define BCKSLSH  92
  63.  
  64. #define HYPHEN 45
  65.  
  66.     
  67.            /* Globals varables define */
  68.  
  69. int video = 0;
  70. int wrrd = 0;
  71. int totwrd; /* TOTAL WORDS */
  72. int  mspwrd; /* miss-spelled words */
  73. int result; /* RESULT OF FOPEN */
  74. int letcnt = 0; /* LETTER COUNT  OF WORD */
  75. int hyphcnt = 0; /* LETTER COUNT  OF WORD */
  76. int perdex = 0;   /* pointer of personal dictionary */
  77. int lnlength = 0; /* length of line */
  78. long int memaval;
  79. char  *path ;
  80. char  *drive;
  81. char  *dirr ;
  82. char  *nam  ;
  83. char  *ext  ; 
  84. char  srcline [MAXLINE];
  85. char  wordtex[MAXWRD] = "";  /* word extracted from source line */
  86. char  hyphtex[MAXWRD] = "";  /* word extracted from source line with hyphen */
  87. char  srchtx[MAXWRD];  /* word extracted from source line */
  88. char  srchtex[MAXWRD];  /* word extracted from source line */
  89. char  *dctenv = NULL;
  90. char  *chrpnt = NULL;
  91. char outln [MAXLINE];
  92. char perdctt = 1;
  93. unsigned char hyphen = 0;
  94. unsigned char hyphen1 = 0;
  95. unsigned char hyphen2 = 0;
  96. unsigned char marker = SEDT_PTP;
  97. char  *srcdir = NULL;
  98. char fylnam [60];
  99. char tmmpnam [60];
  100. char perdctnam [60];
  101. char  *tmpnam;
  102. char  *tmpfyl;
  103. FILE *source;
  104. FILE *perdct;
  105. FILE *output;
  106. FILE *temp;
  107.  
  108.         /* dictionaries defined */
  109.  
  110. #define THREELN  478 
  111. extern char threedct [THREELN] [4];
  112. int threesiz = THREELN;
  113.         
  114. #define FOURLN  1439
  115. extern char fourdct [FOURLN] [5];
  116.  
  117. #define FIVELN  1968
  118. extern char fivedct [FIVELN] [6];    
  119.  
  120. #define SIXLN  2378
  121.  
  122. extern char sixdct [SIXLN] [7];
  123.  
  124. #define SEVNLN  2382
  125. extern char sevndct [SEVNLN] [8];
  126.  
  127. #define EIGHTLN 2013
  128. extern char eightdct [EIGHTLN] [9];
  129.  
  130. #define  NINELN 1807
  131. extern char ninedct [NINELN] [10];
  132.  
  133. #define  TENLN 1331
  134. extern char tendct [TENLN] [11];
  135.  
  136. #define  ELEVENLN 943
  137. extern char elevendct [ELEVENLN] [12];
  138.  
  139. #define  TWELVELN 529
  140. extern char twelvedct [TWELVELN] [13];
  141.  
  142. #define  T3TENLN 347
  143. extern char t3tendct [T3TENLN] [14];
  144.  
  145. #define  FORTENLN 156
  146. extern char fortendct [FORTENLN] [15];
  147.  
  148. #define  FIVTENLN 74
  149. extern char fivtendct [FIVTENLN] [16];  
  150.  
  151. #define  SIXTENLN 42
  152. extern char sixtendct [SIXTENLN] [17]; 
  153.  
  154. #define  SEVTENLN 18
  155. extern char sevtendct [SEVTENLN] [18];
  156.  
  157. #define EITENLN 4
  158. extern char eitendct [EITENLN] [19];
  159.  
  160. int persize;
  161. extern char personaldct [1500] [21];
  162.  
  163. int collums;
  164. int page;
  165. int mode;
  166.  
  167. #ifdef  TIMER
  168. struct time st_time;
  169. struct time end_time;
  170. struct time tot_time;
  171. #endif TIMER
  172.  
  173.  
  174.  
  175. union REGS reg;
  176.  
  177. void GOTOXY(x,y)
  178. int x,y;
  179. {
  180. #ifdef CLONE
  181. reg.h.ah = 2;
  182. reg.h.bh = page;
  183. reg.h.dl = x;
  184. reg.h.dh = y;
  185. int86(0x10,®,®);
  186. #endif CLONE
  187.  
  188. #ifdef RAINBOW
  189. cprintf("\033[%1d;%1df",y,x);
  190. #endif RAINBOW
  191. }
  192.  
  193. void selpage(page)
  194. int page;
  195. {
  196. reg.h.ah = 5;
  197. reg.h.al = 131;
  198. reg.h.bh = page;
  199. reg.h.bl = 01;
  200. int86(0x10,®,®);
  201. }
  202.  
  203.  
  204. int getmode()
  205. {
  206. reg.h.ah = 15;
  207. reg.h.al = 0;
  208. reg.h.bh = 0;
  209. reg.h.bl = 0;
  210. int86(0x10,®,®);
  211. mode = reg.h.al;
  212. page = reg.h.bh;
  213. collums = reg.h.ah;
  214. #ifdef DEBUG
  215. printf("%d  active page  %d   mode    %d collums",page,mode,collums);
  216. getche();
  217. #endif DEBUG
  218. }
  219.        
  220. void CLRSCRN()
  221. {
  222. #ifdef CLONE
  223. reg.h.ah = 6;
  224. reg.h.al = 25;
  225. reg.h.bh = 7;
  226. reg.h.ch = 0;
  227. reg.h.cl = 0;
  228. reg.h.dl = 79;
  229. reg.h.dh = 25;
  230. int86(0x10,®,®);
  231. #endif CLONE
  232.  
  233. #ifdef RAINBOW
  234. cprintf("\033[2J");
  235. #endif RAINBOW
  236.  
  237. GOTOXY(0,0);
  238. }
  239.  
  240. #ifdef  CLONE
  241.  
  242. void scrolup(x)
  243. int x;
  244. {
  245.         reg.h.ah = 6;
  246.         reg.h.al = x;
  247.         reg.h.bh = 7;
  248.         reg.h.ch = 6;
  249.         reg.h.cl = 0;
  250.         reg.h.dl = 79;
  251.         reg.h.dh = 20;
  252.         int86(0x10,®,®);
  253.         GOTOXY(00,19);
  254. }
  255.  #endif CLONE
  256.  
  257. #ifdef CLONE
  258.      
  259. void scroldwn(x)
  260. int x;
  261. {
  262. GOTOXY(30,22);
  263. reg.h.ah = 7;
  264. reg.h.al = x;
  265. reg.h.bh = 7;
  266. reg.h.ch = 22;
  267. reg.h.cl = 30;
  268. reg.h.dl = 60;
  269. reg.h.dh = 25;
  270. int86(0x10,®,®);
  271. }
  272. #endif CLONE
  273.  
  274.  
  275.  
  276. char  *getpath(filnm)
  277. char  filnm [60];
  278. {
  279. char  *dirr;
  280. char  *ptr;
  281. int    lnlgth;
  282. int    indx;
  283. lnlgth = strlen(filnm);
  284. while ((filnm[lnlgth] != COLON) && (filnm[lnlgth] != SLASH) && (filnm[lnlgth] != BCKSLSH))
  285. lnlgth--;
  286. if (coreleft())
  287. dirr = malloc (61);
  288. ptr = dirr;
  289. for(indx = 0; indx <=lnlgth; indx++)
  290. {
  291. *ptr = filnm[indx];
  292. ptr++;
  293. }
  294. if(filnm [indx-1] == COLON)
  295. {
  296. *ptr = SLASH;
  297. ptr++;
  298. }
  299. *ptr = 0;
  300. return(dirr);
  301. }         
  302.  
  303.  
  304.         
  305.         
  306.         
  307.  
  308.  
  309.         
  310. void dumpdic()
  311.      {
  312.  
  313.       char buf;
  314.       int totdic = 0;
  315.       register int index = 0;        
  316.  
  317. #ifdef RAINBOW
  318.       GOTOXY(00,19);
  319. #endif RAINBOW
  320.  
  321.       while (index < THREELN)
  322.       {
  323.       totdic++;
  324. #ifdef CLONE  
  325.       scrolup (1);
  326.       cprintf ("%d     %s   %d  ",index,threedct [index],totdic );
  327. #endif CLONE
  328.  
  329. #ifdef RAINBOW
  330.       cprintf ("%d     %s   %d  \n\r",index,threedct [index],totdic);
  331. #endif RAINBOW
  332.  
  333.       index++;
  334.       }
  335.     
  336.       index = 0;
  337.     
  338.       while (index < FOURLN)
  339.       {
  340.       totdic++;
  341. #ifdef CLONE  
  342.       scrolup (1);
  343.       cprintf ("%d     %s   %d   ",index,fourdct [index], totdic);
  344. #endif CLONE
  345.  
  346. #ifdef RAINBOW
  347.       cprintf ("%d     %s   %d  \n\r ",index,fourdct [index], totdic);
  348. #endif RAINBOW
  349.  
  350.       index++;
  351.       }
  352.  
  353.       index = 0;
  354.  
  355.       while (index < FIVELN)
  356.       {
  357.       totdic++;
  358.  
  359. #ifdef CLONE
  360.       scrolup (1);
  361.       cprintf ("%d     %s   %d ",index,fivedct [index],totdic ); 
  362. #endif CLONE
  363.  
  364. #ifdef RAINBOW
  365.       cprintf ("%d     %s   %d \n\r",index,fivedct [index],totdic ); 
  366. #endif
  367.  
  368.      index++;
  369.       }
  370.       index = 0;
  371.  
  372.       while (index < SIXLN)
  373.       {
  374.       totdic++;
  375. #ifdef CLONE
  376.       scrolup (1);
  377.       cprintf ("%d     %s  %d ",index,sixdct [index],totdic ); 
  378. #endif CLONE
  379.  
  380. #ifdef RAINBOW
  381.       cprintf ("%d     %s  %d \n\r",index,sixdct [index],totdic ); 
  382. #endif RAINBOW
  383.  
  384.       index++;
  385.       }
  386.  
  387.       index = 0;
  388.       while (index < SEVNLN)
  389.          
  390.       {         
  391.       totdic++;
  392. #ifdef CLONE
  393.       scrolup (1);
  394.       cprintf ("%d     %s  %d ",index,sevndct [index],totdic ); 
  395. #endif CLONE
  396.  
  397. #ifdef RAINBOW
  398.       cprintf ("%d     %s  %d \n\r",index,sevndct [index],totdic ); 
  399. #endif RAINBOW
  400.  
  401.       index++;
  402.       }
  403.         index = 0;
  404.       while (index < EIGHTLN)
  405.          
  406.       {         
  407.       totdic++;
  408. #ifdef CLONE
  409.       scrolup (1);
  410.       cprintf ("%d     %s  %d ",index,eightdct [index],totdic ); 
  411. #endif CLONE
  412.  
  413. #ifdef RAINBOW
  414.         cprintf ("%d     %s  %d \n\r",index,eightdct [index],totdic ); 
  415. #endif RAINBOW
  416.  
  417.      index++;
  418.       }
  419.  
  420.  
  421.  
  422.  
  423.  
  424.         index = 0;
  425.         
  426.       while (index < NINELN)
  427.          
  428.       {         
  429.       totdic++;
  430. #ifdef CLONE
  431.       scrolup (1);
  432.       cprintf ("%d     %s  %d ",index,ninedct [index],totdic );
  433. #endif CLONE
  434. #ifdef RAINBOW
  435.       cprintf ("%d     %s  %d \n\r",index,ninedct [index],totdic ); 
  436. #endif RAINBOW
  437.  
  438.       index++;
  439.       }
  440.       index = 0;
  441.           
  442.       while (index < TENLN)
  443.          
  444.       {         
  445.       totdic++;
  446. #ifdef CLONE
  447.       scrolup (1);
  448.       cprintf ("%d     %s  %d ",index,tendct [index],totdic );
  449. #endif CLONE
  450. #ifdef RAINBOW
  451.       cprintf ("%d     %s  %d \n\r",index,tendct [index],totdic ); 
  452. #endif RAINBOW
  453.       ind